package com.mvp.shq.washer.ui.contactUs;

import android.os.Bundle;
import android.support.v4.content.ContextCompat;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.jaeger.library.StatusBarUtil;
import com.mvp.shq.washer.R;
import com.mvp.shq.washer.base.BaseActivity;
import com.mvp.shq.washer.utils.JumpUtil;
import com.mvp.shq.washer.utils.T;
import com.mvp.shq.washer.view.widget.CustomDialog;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class ContactUsActivity extends BaseActivity<ContactUsPresenter, ContactUsModel> implements ContactUsConstract.View {

    @BindView(R.id.back)
    ImageView back;
    @BindView(R.id.title)
    TextView title;
    private CustomDialog dialog;
    private String mobile;

    @Override
    public int getLayoutId() {
        return R.layout.activity_contact_us;
    }

    @Override
    public void initView() {
        StatusBarUtil.setColor(this, ContextCompat.getColor(context,R.color.white),0);
    }


    @OnClick({R.id.back, R.id.arl_seriver, R.id.arl_refund,R.id.arl_fault_feedback, R.id.arl_feedback, R.id.arl_aboutus})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.back:
                finish();
                break;
            case R.id.arl_seriver:
                showLoadingDialog(true);
                presenter.getHotline("hotline");
                break;
            case R.id.arl_refund:
                break;
            case R.id.arl_feedback:
                JumpUtil.toFeenBack(context);
                break;
            case R.id.arl_aboutus:
                JumpUtil.toAboutUs(context);
                break;
            case R.id.arl_fault_feedback:
                JumpUtil.toFaultFeedBack(context);
                break;
        }
    }

    @Override
    public void getHotlineS(String phone) {
        mobile = phone;
        CustomDialog.Builder builder = new CustomDialog.Builder(context);
        dialog = builder.setMessage("客服热线:"+mobile)
                .setPositiveButton("取消", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialog.dismiss();
                    }
                })
                .setNegativeButton("拨打", new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        JumpUtil.call(context,mobile);
                    }
                }).createTwoButtonDialog();
        dialog.show();
    }

    @Override
    public void getHotlineF(String msg) {
        T.show(msg);
    }
}
